#ifndef GAME_H_GGJ
#define GAME_H_GGJ

#include <sfml/Graphics.hpp>
#include "Screens/BaseScreen.h"
#include "Defines.h"

/////////////////////////////////////////////////////////
// Defines
/////////////////////////////////////////////////////////

#define MAX_CHARS	4

/////////////////////////////////////////////////////////
// Classes
/////////////////////////////////////////////////////////

class CCharacter;

class CGame
{
public:
	~CGame();

	static CGame* Instance();

	void SetRenderWindow(sf::RenderWindow* pWin) { m_pWin = pWin; }

	// The 3 funcs used by main.cpp to start/run/quit the game 
	bool	Initialise();
	void	Run();
	void	Cleanup();

	bool	IsRunning() { return m_bRunning; }

	void			SetActiveChar(int iChar) { m_iActiveChar = iChar; }
	int			GetActiveChar() { return m_iActiveChar; }
	void			ChangeState();
	void			RequestStateChange(EGameState eState) { m_ePendingState = eState; }
	CBaseScreen* GetActiveScreen() { return m_pActiveScreen; }
	EGameState   GetActiveState() { return m_eGameState; }

	sf::Font&	GetFont() { return m_tGameFont; }

protected:
	CGame();

	// Standard loop functions, called by Run()
	void	Render();
	void	Process(float fTimeDelta);
	void	ProcessInput();

	// Game state
	EGameState	m_eGameState;
	EGameState	m_ePendingState;

private:
	sf::RenderWindow*	m_pWin;
	sf::Clock			m_tClock;
	bool				m_bRunning;

	// Playable characters
	int			m_iActiveChar;

	CBaseScreen*	m_pActiveScreen;

	sf::Font		m_tGameFont;

	//////////////////////////////////////
	// Splash screen
	sf::Texture			m_tSplashTex;
	sf::Sprite			m_tSplash;

	sf::Texture			m_tSplashFunTex;
	sf::Sprite			m_tSplashFun;
};

#endif // GAME_H_GGJ